<%-- 
    Document   : MenuUser
    Created on : Nov 18, 2011, 10:24:55 AM
    Author     : JackOddie
--%>


<%@page contentType="text/html" pageEncoding="UTF-8"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<%@page import="java.util.GregorianCalendar"%>
<%@page import="java.util.Calendar"%>
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <link media="all" href="style.css" type="text/css" rel="stylesheet">
        <title>Menu User</title>
        <link href="style.css" rel="stylesheet" type="text/css" />
        <script language="javascript" type="text/javascript">
            function MM_jumpMenu(targ,selObj,restore){ //v3.0
                eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
                if (restore) selObj.selectedIndex=0;
            }
        </script>
    </head>
    <body>
        
        <%

            if (request.getParameter("id") != null && request.getParameter("passWd") != null) {
                if (session.getAttribute("userOnline") == null) {
                    Entities.User online = new Entities.User(request.getParameter("id"),
                            request.getParameter("passWd"));
                    online.getAllData();
                    online.toggleLogin();
                    session.setAttribute("userOnline", online);

                }
            }
        %>
        
        
        <div id="wrapper">
            
            <div id="header">
                <h1>Sistem Pembantu Penjadwalan Studio Musik</h1> versi sesuatu.86
            </div>
            <%Calendar calz = new GregorianCalendar();%>
            <div id="nav">
                <%if (session.getAttribute("userOnline") == null) {%>
                <ul>
                    <li ><a href="?action=index"> Home User </a></li>
                    
                    <li class="selected"><a href="?action=menuUser&month=<%=calz.getTime().getMonth()+1%>&year=<%=calz.getTime().getYear()+1900%>"> Lihat Jadwal </a></li>
                    <li><a href="?action=login"> Login</a></li>
                </ul>
                <%} else {%>
                <ul>
                    <li class="selected" ><a href="?action=menuUser&month=<%=calz.getTime().getMonth()+1%>&year=<%=calz.getTime().getYear()+1900%>"> Home User </a></li>
                    <li><a href="?action=studio"> Tambah Studio</a></li>
                    <li><a href="?action=logout"> Logout </a></li>
                </ul>
                <%}%>
            </div>
            <div id="nav2">
                <a href="?action=menuUser&month=<%=calz.getTime().getMonth()+1%>&year=<%=calz.getTime().getYear()+1900%>">Home </a>
                
            </div>
            <br/>
            <table><tr><td>
                        <select name="Month" onchange="MM_jumpMenu('parent',this,0);MM_jumpMenu('parent',this,0);MM_jumpMenu('parent',this,0);MM_jumpMenu('parent',this,0);MM_jumpMenu('parent',this,0);MM_jumpMenu('parent',this,0);MM_jumpMenu('parent',this,0);MM_jumpMenu('parent',this,0);MM_jumpMenu('parent',this,0);MM_jumpMenu('parent',this,0);MM_jumpMenu('parent',this,0);MM_jumpMenu('parent',this,0)">
                            <option selected="selected"> Choose Month </option>
                            <option value="?action=menuUser&month=1&year=<%=request.getParameter("year")%>" > January</option>
                            <option value="?action=menuUser&month=2&year=<%=request.getParameter("year")%>" > February</option>
                            <option value="?action=menuUser&month=3&year=<%=request.getParameter("year")%>"> March</option>
                            <option value="?action=menuUser&month=4&year=<%=request.getParameter("year")%>"> April</option>
                            <option value="?action=menuUser&month=5&year=<%=request.getParameter("year")%>"> May</option>
                            <option value="?action=menuUser&month=6&year=<%=request.getParameter("year")%>"> June</option>
                            <option value="?action=menuUser&month=7&year=<%=request.getParameter("year")%>"> July</option>
                            <option value="?action=menuUser&month=8&year=<%=request.getParameter("year")%>"> August</option>
                            <option value="?action=menuUser&month=9&year=<%=request.getParameter("year")%>"> September</option>
                            <option value="?action=menuUser&month=10&year=<%=request.getParameter("year")%>"> October</option>
                            <option value="?action=menuUser&month=11&year=<%=request.getParameter("year")%>"> November</option>
                            <option value="?action=menuUser&month=12&year=<%=request.getParameter("year")%>"> December</option>
                    </select></td>
                    <td>
                    
                    <select name="Year" onchange="MM_jumpMenu('parent',this,0);MM_jumpMenu('parent',this,0);MM_jumpMenu('parent',this,0);">
                        <option selected="selected" value="?action=menuUser&year=<%=calz.getTime().getYear() + 1900 %>&month=<%=request.getParameter("month")%>"> Choose Year </option>
                        <option  value="?action=menuUser&year=<%=calz.getTime().getYear() + 1900 %>&month=<%=request.getParameter("month")%>"><%=calz.getTime().getYear() + 1900 %></option>
                        <option  value="?action=menuUser&year=<%=calz.getTime().getYear() + 1901 %>&month=<%=request.getParameter("month")%>"><%=calz.getTime().getYear() + 1901 %></option>
                    </select>
                <td></tr>
            </table><%int bulan;
            if (request.getParameter("month") != null) {
                bulan = Integer.parseInt(request.getParameter("month"));
            } else {
                Calendar cal = new GregorianCalendar();
                bulan = cal.getTime().getMonth() + 1;
            }
            int x = 1;
            int jumTanggal = 32;
            if (bulan % 2 == 0 && bulan <= 7) {
                jumTanggal = 31;
            } else if (bulan % 2 != 0 && bulan >= 8) {
                jumTanggal = 31;
            }%>
            
            <% String arrString[] = {"January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"};%>
            <h2><%=arrString[bulan - 1]%>,<%=request.getParameter("year")%></h2>
            <table border="0" cellspacing="2" width="100%" height="400">  
                
                
                <%for (int i = 0; i < 4; i++) {%>
                <tr>
                    <%for (int j = 0; j < 10; j++) {%>
                    
                    <%if (x < jumTanggal) {%>
                    <td bgcolor="#ffcccc" align="center">
                       <%if(x<calz.getTime().getDate()&&Integer.valueOf(request.getParameter("month"))<=calz.getTime().getMonth()+1&&Integer.valueOf(request.getParameter("year"))<=calz.getTime().getYear()+1900){%> <%}else if(Integer.valueOf(request.getParameter("month"))<calz.getTime().getMonth()+1&&Integer.valueOf(request.getParameter("year"))<=calz.getTime().getYear()+1900){%> <%}else{%> <a href="?action=date&bulan=<%=bulan%>&tanggal=<%=x%>&tahun=<%=request.getParameter("year")%>" > <%}%> <%=x%></a>
                    </td>
                    <%} else {
        break;
    }%>              
                    
                    
                    <%x++;
    }%>
                </tr>
                <%}%>
            </table>
        </div>
    </body>
</html>
